package
{
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.events.SecurityErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	
	import root.TestRoot;
	
	public class LoadText extends TestRoot
	{
		private	var	_urlLoader:URLLoader = null;
		
		public function LoadText()
		{
			super();
			this._urlLoader = new URLLoader();
			var urlReq:URLRequest = new URLRequest("http://localhost/example.txt");
			this._urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
			this._urlLoader.addEventListener(Event.COMPLETE, onLoadComplete);
			this._urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIoError);
			this._urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
			this._urlLoader.load(urlReq);
		}
		
		public	function	onLoadComplete(evt:Event):void{
			trace(this._urlLoader.data);
		}
		
		public	function	onIoError(evt:IOErrorEvent):void{
			traceHtml(evt.toString());	
		}
		
		public	function	onSecurityError(evt:SecurityErrorEvent):void{
			trace(evt.text);
		}
	}
}